#ifndef CROX_TABLE_H
#define CROX_TABLE_H

#include "value.h"

typedef struct {
    ObjString* key;
    Value value;
} Entry;

typedef struct {
    int count;
    int capacity;
    Entry* entries;
} Table;

void initTable(Table* table);

void freeTable(Table* table);

bool getTable(Table* table, ObjString* key, Value* value);

bool putTable(Table* table, ObjString* key, Value value);

bool deleteTable(Table* table, ObjString* key);

void tableAddAll(Table* from, Table* to);

ObjString* tableFindString(Table* table, const char* s, int length, uint32_t hash);

void markTable(Table *table);

void tableRemoveWhite(Table *table);

#endif //CROX_TABLE_H
